import Cookies from 'js-cookie'

const CURRENT_PID = 'Current_Pid'

const ISSUE_STATUS_KEY = 'Current_Issue_Status'

const ISSUE_PK_KEY = 'Current_Issue_Pk'

export function getCurrentPid(){
    return Cookies.get(CURRENT_PID)
}
export function setCurrentPid(pid){
    return Cookies.set(CURRENT_PID,pid)
}

export function removePid(){
    return Cookies.remove(CURRENT_PID)
}

export function getIssueStatus(){
    if(getCurrentPid()){
        return Cookies.get(ISSUE_STATUS_KEY)
    }else{
        Cookies.remove(ISSUE_STATUS_KEY)
        return null
    }
}

export function setIssueStatus(issue_status){
    return Cookies.set(ISSUE_STATUS_KEY,issue_status)
}

export function getIssuePk(){
    if(getCurrentPid()){
        return Cookies.get(ISSUE_PK_KEY)
    }else{
        Cookies.remove(ISSUE_PK_KEY)
        return null
    }
}

export function setIssuePk(issue_pk){
    return Cookies.set(ISSUE_PK_KEY,issue_pk)
}


export function swtichStatusColor(status){
    switch (status){
        case 1:return 'blue';
        case 2:return 'azure';
        case 3:return 'green';
        case 4:return 'red';
        case 5:return 'cyan';
        case 6:return 'dark';
        case 7:return 'gray';
        default:return ''
    }
}
export function swtichStatusText(status){
    switch (status){
        case 1:return '新建';
        case 2:return '处理中';
        case 3:return '重新打开';
        case 4:return '待反馈';
        case 5:return '已解决';
        case 6:return '已忽略';
        case 7:return '已关闭';
        default:return ''
    }
}
